package com.pure;

import com.pure.annotation.EnableCustomSwagger2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@EnableScheduling // 启用定时任务调度
@EnableCustomSwagger2 // 启用自定义 Swagger2
@SpringBootApplication
public class PureNutritionApplication {

    public static void main(String[] args) throws UnknownHostException {

        log.info("(♥◠‿◠)ﾉﾞ    pure nutrition services started.      ლ(´ڡ`ლ)ﾞ");
        ConfigurableApplicationContext run = SpringApplication.run(PureNutritionApplication.class, args);
        ConfigurableEnvironment env = run.getEnvironment();
        log.info("(♥◠‿◠)ﾉﾞ    pure nutrition service started successfully.      ლ(´ڡ`ლ)ﾞ\n" +
                "   __________ ____ ________________________       \n" +
                "   \\______   \\    |   \\______   \\_   _____/   \n" +
                "    |     ___/    |   /|       _/|    __)_        \n" +
                "    |    |   |    |  / |    |   \\|        \\     \n" +
                "    |____|   |______/  |____|_  /_______  /       \n" +
                "                              \\/        \\/     ");
        log.warn("\n####################################################\n" +
                "WebSocket:\t" +
                "ws://" + InetAddress.getLocalHost().getHostAddress() + ":" + env.getProperty("server.port") + "/websocket\n" +
                "External:\t" +
                "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + env.getProperty("server.port") + "\n" +
                "Doc:\t\t" +
                "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + env.getProperty("server.port") + "/swagger-ui/index.html\n" +
                "####################################################");
    }

}
